/**
 * 
 */
package cn.panda.edu.service.impl;

import cn.panda.edu.dao.CoursewareMapper;
import cn.panda.edu.model.Courseware;
import cn.panda.edu.service.CoursewareService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**  
 * 类描述：  
 * @author: 苑庆涛 
 * @date： 2018-01-16 下午7:40:22  
 */
@Service
public class CoursewareServiceImpl implements CoursewareService {

	@Resource
	private CoursewareMapper mapper;
	/* (non-Javadoc)
	 * @see cn.panda.edu.serviceapi.CoursewareService#getAllCourseware(java.lang.String)
	 */
	@Override
	public PageInfo<Courseware> getAllCourseware(Integer pageIndex,Integer pageSize,String name) {
		
		PageHelper.startPage(pageIndex,pageSize);
		List<Courseware> list=mapper.getAllCourseware(name);
		PageInfo<Courseware> pageInfo=new PageInfo<>(list);
		return pageInfo;
		
	}
	/* (non-Javadoc)
	 * @see cn.panda.edu.serviceapi.CoursewareService#deleteByPrimaryKey(java.lang.Integer)
	 */
	@Override
	public int deleteByPrimaryKey(Integer coursewareId) {
		// TODO Auto-generated method stub
		return mapper.deleteByPrimaryKey(coursewareId);
	}
	/* (non-Javadoc)
	 * @see cn.panda.edu.serviceapi.CoursewareService#insert(cn.panda.edu.model.Courseware)
	 */
	@Override
	public int insert(Courseware record) {
		// TODO Auto-generated method stub
		return mapper.insert(record);
	}

}
